-- user_attrib
-- created by zhuangsl
-- 召唤兽：属性根据玩家属性计算的

return {
    fetchInitData = function(classId)
        local maxHp = ME.user:queryAttrib("max_hp");
        local attack = ME.user:queryAttrib("attack");

        -- 继承的系数
        local dbase = SummonM.query(classId, "dbase");
        local hpCoef = dbase["hp_coef"] or 0;
        local attackCoef = dbase["attack_coef"] or 0;

        maxHp  = FormulaM.invoke("CALC_BIG_DIVISION", maxHp, hpCoef, 1000);
        attack = FormulaM.invoke("CALC_BIG_DIVISION", attack, attackCoef, 1000);

        maxHp = math.max(maxHp, 1);
        attack = math.max(attack, 1);

        return {
            ["hp"] = maxHp,
            ["max_hp"] = maxHp,
            ["attack"] = attack,
        };
    end,
};
